<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png">
     <h1>封装echart组件</h1>
     
     <div class="mychart">
        <myChart chartId="chart_a" :option="option" ></myChart>
     </div>
  </div>
</template>

<script>

import myChart from '@/components/Myecharts.vue'
export default {
  name: 'App',
  data(){
    return{
        option:{}
    }
  },
  methods:{
    initdata(){
       this.$axios({
        method: "get",
        url: "https://mock.presstime.cn/mock/6332c22563aa9d006c2edf51/example/echarts",
      }).then( res=>{
    
          console.log("请求结果",res.data);
          this.option = res.data
      }).catch( err=>{
        console.log(err);
      })
    }
  },
  mounted(){
   this.initdata();
    console.log("option",this.option)
  },
  
  components: {
    myChart
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.mychart{
  width: 700px;
  height: 600px;
}
</style>
